package collection;

import java.util.HashMap;
import java.util.Scanner;

public class Test02_Map {

	public static void main(String[] args) {
		Person per1 = new Person("Jint","010-9466-7439");
		Person per2 = new Person("Kim","010-1234-5678");
		Person per3 = new Person("Lee","010-1111-2222");

		HashMap<String,Person> hm = new HashMap<String,Person>();

		hm.put(per1.getIrum(), per1);
		hm.put(per2.getIrum(), per2);
		hm.put(per3.getIrum(), per3);

		Scanner sc = new Scanner(System.in);
		System.out.println("이름을 입력하세요.");
		String find = sc.next();

		Person per=hm.get(find);
	
		
		
		if(per!=null){
			System.out.println("이름 : " + per.getIrum() + "   전화번호 : " + per.getPhone());
		}else{
			System.out.println("찾으시는 이름이 없습니다.");			
		}
	}



}

class Person{
	String irum, phone;
	public Person(String a, String b){
		this.irum=a;
		this.phone=b;
	}
	public String getIrum() {
		return irum;
	}
	public String getPhone() {
		return phone;
	}

}